Refactoring, bug fixes, test cases, clean up, hooray