Refactoring.
Added Scaladoc.