documentation and structure

    - added documentation to all important methods
    - restructures js code for easier testing of different
    features (i.e. calling different methods)
    - restructured api proxy to use oop style