object pattern matching
slight cleanup