Implemented isEmpty() to pass tests.