add init function to all objects and init objects in factory