JS style refactoring