more explicit classes for returned objects

Unfortunately, this may make the code more brittle in the future.