Some work towards adding logging & response handling from mega.co.nz (reverse-merged from commit 1012af2f90c251aa02f0ad912f9dfd33f181485c)