Refactored and combined