fixed code to account for the case when the routine has no exercises. cleaned up some code