Refactor

I did a little re-factoring that might simplify things a little.