Magnetic structure and electric field effects in multiferroic YMn2O5