redirects and more refactoring