Move common code to utility class
Remove debug code.
Remove unused field 'instance'.
Add cedar tree generation.
Encode log block direction in its metadata