refactored code and docs
resolved conflicts