added loops to read and write laserplan to write and read multiple modes