Refactoring js files for room view