Implement logger/timer and refactor