polished code and docs