beginning init function