Major design changes + refactored js-code