More refactor to handle scoped urls