Cleaning up code slightly