I think you can move checkSubDomain and this code in the same method. And you don't want to return early, you just want to set "href".