further reduced duplication by using dynamic method calls