Changes from master branch

Despite the fact that scala_2.10 is now the main development branch, some new work has been done on master branch since release 1.6. This PR is a rebase of that work onto scala_2.10 branch with necessary adjustments.