fixing/cleaning the code