refactored
removed duplication