example code refactorying