update to the room algorithm