Cleaning up the code (simplifying it)