fixed time slice so that when execution time is smaller than time slice, CPU only works on for the execution time, removed duplicate code