Further refactoring on gradient

* corrected some names (e.g. pattern_position --> create pattern)
* extracted further methods, that belong together
* opening PR as request for Feedback/Help :-)