added haddock comments, cleaned up warnings