Improved code for compiling organogram CSV