init logic