Added documentation, other small improvements.