code cleanup and docs
refactored changes