Move redirect logic into separate class