Slightly refactored code again