pass moose namespace as part of type hash instead of separately
refactor code