Fixed for new Moose version, added tests.