Cleaned out the debug fucntiona  bit more and added some debug statements to response_redirect()