code cleanup; more plotting