Refactor empty method to isEmpty.