Race conditions solved for Midterms, allocation improved