Refactored conditions to be an object and avoid string formatting issues