Restructuring and cleanup