Reorder some checks, could speed things up a negligible bit