Cleanup code and add dart docs.