rewriting route handling