Cleanup and code re-org