extracted some parts from initialize to make it shorter