WIP: Move to JS and Refactoring