minor refactoring for more readable code