Use mw.Api more consistently and a bit of error handling

Change-Id: I3d4a2d922d1de29d0d877937bbb23819785e6e45
Merge "Use mw.Api more consistently and a bit of error handling"