refactored code in presentation view