cleaned up code a bit, removed repeats, unneeded code.