Improvements

See commit messages for more details.