Using getattr to call the proper method by name