cleaning up a bit of the code