added docs
updated code