performance improvement; code cleanup