Cleaning up code further