Refactoring into js folder