Added doc and some minor improvements