minor refactoring for assignment solution