Refactor function calls

per @marczych's suggestions.