Cleaning code - restructure reading and writing datafiles. varcleaner utility added.