improved doc and clean up