Refactors aplenty
General bugfixery