Refactor init_map function into seperate file