Fixed bug where more specific domain might not get used. Added comments
Added comments and test case for more specific domain