updated code and some docs