made the init logic