Refactor into conditions struct