Switched to a more OOP design on the JS part