I do it through iTunes. Make sure to disable Find My iPhone first. After disabling Find My iPhone in your iCloud settings, press and holy the power button and the home button until the phone restarts. Then, keep holding those two buttons until you see an image telling you to plug your phone into iTunes. Then Restore.