Refactor room.js