Re: how to factory reset
Settings/Backup & Reset/ then select factory reset.
Make sure you have backup my data enabled. Also make sure you Gmail, Contacts, Photos are sync'd up with your Google Account under Settings/Accounts & sync and/or loaded off your phone to your computer. You can export Contacts to a file and reload and same goes for pictures or allow Google to back them up (which is always a given for most).
Text messages can be saved using a free app called SMS Backup & Restore found in the Google Play Store.
If you have a SDCARD installed it shouldn't touch that but for safety you may wish to unmount or remove the card.