01 - more JS refactoring