Refactoring.

API clean up, better JSON parsing, better atlas, easier to extend.