Clean up code.
Update docs and clean up code format.