Updated the Router to handle prefixes better