Refactored to use potemin. Coming out nicely.