refactorying duplicate code