added isEmpty function