merge code from http://github.com/chawei/treasuremap-web