Added dynamic method generation code & tests.