cleaning up code a bit