refactor prepare. Use same functionality for wp7, wp8 and windows8