Started refactoring and putting in time slice