Add Haddock documentation for most new functions
Fix warning