add new condition and refactor