Significantly improved modularity and encapsulation

Moved classes into separate python files. In main javascript generation
file added functions for each task to improve code clarity.