minor edits for better error checking and spinner