Fixed timer bug by adding custom Timer class