Refactored, ready for release