Restricting instance fields and unwrapping returned objects with a single function