cleaned up code, nicer now