added class and function documentation
coding style fixes