Tuning the properties of an MgO layer for spin-polarized electron transport