This fixes #2 and #3 by making the method generation code a little more
intelligent.