cleaned up a bunch of code