Improve the Result class.

Add some optional return data.
Syntax fixes.
Clean the dirty branches after performing the sync (untested).