code cleanup; performance improvement