Refactored a LOT.