Corrections and optmizations.