changed quite few things, refactoring commit
added file writing capability through the ug_io library