Added first part of Mark's redirect code.