Tests updated. Multiple fixes and improvements