moved shared functions to base classes (polymorphism for the win)