Refactored code in workouts backend and exercise scripts frontend.
merged
mentioned in commit f742d804