preliminary code to support manual redirect following + error handling