Use .empty() instead of compare .length() to 0