Formatting and basic refactoring! Ready for release!