Improvements

See commit for details.