Improve memory handling of rooms, add simple memory test