Reimplement `empty` in terms of a class (#46)