Initial time saving implementation, minor code refactoring