added timer to increment progress bar, cleaned up duplicate code