cleaning up code so other people can read it
more refactoring