Merging in fixes and improvements from Play (https://github.com/JanX2/Play).