Code cleanup; tweaks