Modified to include the head and redirect variable.