Lots of improvements done with the help of hlint