updated some documentation, some refactoring and TODO items.