Reorder checks to avoid redundant actions