minor improvements, pls see commit messages