refactored, and made it buildable again.