refactor into object / remove interface from js