A more concise implementation of getInstances() thanks to feedback from samskivert.