refs #13 - bugfixes, restructuring, remove of old code