constructor logic moved to a init function