Apply some fixes and improvements