ENH: cleaning up build warning and using polymorphism to clean up the calling code