changed: use .empty() instead of testing for .size() > 0