Cleaned up length checks