minor refactoring of function parameters and return values