js skeleton: refactoring