removed some duplication (refactoring