Quality and unittests improvements