This check seems like it would be useful for any type, so it should be moved to just under line 154.