Did a lot of refactoring and organizing

This should all be in better style in addition to allowing me to treat
certain objects differently from certain other objects.