Integration, refactoring, and cleanup