Merge branch 'emaclite-improve-error-handling-and-minor-cleanup'