extracted some parts from initialize to make it shorter
Merge pull request #902 from herby/refactor-helpers-initialize

extracted some parts from initialize to make it shorter