Refactored: Less complex code