refactoring examples
improvement in refactor function