Added timer registry. Various clean ups, refactoring.