cleaning the code a bit