add some scaladocs, minor codestyle