Refactorings wip

first round of reorganization;

more to come...