Finished gradients updates to spec. Refactored helper functions to helpers directory