Little bit refactored code