Code cleanup and initial work on v1.2