working version with multi-room input file.