clean codes, refactor map and add gyp config for Mac