General fixes and improvements