Messed a little bit with the code