prettifying the code (now working)