The following code does work how I need it to, but it's ugly, excessive or a number of other things. I&ap