Completed code of initilizing data