performance improvement: avoiding unnecessary list construction