Update redirect function
Update ajax magic