updated documentation, commented code