Moved setting of code mode for urlHandler to be the first thing that happens