refactor unless elses