Magnetization Switching and Microwave Oscillations in Nanomagnets Driven by Spin-Polarized Currents