Format documentation and fix complexity anotations.
Remove redundant unionR and unionL functions.