Refactored massively.