changes to classes, more functionality refactored, some js rewriten