Changed the code for the better