Moved the redirect to list/item logic to functions.