Timings, optimzations, code refactoring