vastly improved the whole JS structure