trying to find an elegant functional solution for a typical OOP problem