refactored extra-credit