changed to OOP paradigm
JS bugfix and php refactor