small code cleanup, improved doc