Extending a domain and then using it in the same module causes confusion since it is not clear whether one is referring to the original domain or its extension. You need to place the code for the extension in a separate file and continue as normal.