Refactored and ready for stronger AI