adding in auth header for produciton and also sending back acurrate status codes
cleaning stuff up in main file