Refactor to get rid of redundant check