Changed the checking of flags to before the long processing, so the user will know whether or not he or she messed up the flags without having to wait for the process to finish.