add default parameter, a bit of refactoring