Refactor room position logic to be more generic and reasonable