cleaned up documentation, comments and some formatting