[fix] Log errors, externalise device operations, and some fixes