Varous fixes and improvements.