Refactor conditions