Refactoring js all da dayzzzz