major cleanup (refactoring and deletion of unnecessary old stuff)