Various fixes and improvements to existing functionality.