Removed fmt and handles error on redirect.