Refactored for easier reading