refactored code into separate ns