Major refactor, internal structure changes, javascript structure changes