split code into seperate files and amended map