updated code and docs