refactored identical methods into a base class
Revert "refactored identical methods into a base class"

This reverts commit 439eb3b842cf069ada232a1f87afcdd7b12a617d.
Revert "Revert "refactored identical methods into a base class""

This reverts commit c47b7ec819c9bbddcd54a1b643a898cd18e277be.
refactored identical member functions into a base class