Dynamically define methods.