renamed redirect variable to redirect_to to avoid collision with inbuilt flask function