Revert "Massive code cleanup - no actual changes"

This reverts commit b6a1e75d9bfc2d2a236b3362f181555fb17d313f.