Added scaladoc; tidied.