cleanup code and doc