Cleaning up code, timing