added some error checking and instruction dialogs