clean up the code a bit