Removed hairpin stuff, and started cleaning code