big number of fixes and improvements