Extract common methods into data structure and dynamically generate them