Cleaned up code and forced loop duration