Adds error handling an redirect in phase 2