Improved decl search through scopes.
Streamlined output - removed unnecessary casting to use actual structs instead of BBObject.