Refactor code to get domain directly instead of restrictedTraverse