Some improvements of mega algorithm