I'm going to merge this and then apply @dbussink's suggested code. It's much more clear.