changed so zappa runs only after security validations are complete, and also added some repeat loop safety