Refactored the traversal to return a JsObject instead of Seq[JsValue]