Fix some haddock syntax
Reformat INLINE pragmas
Add haddocks
Rearrange function order