Major cleanup in dev branch