Added documentation, updated source code.