refactoring, adding more type classes, disambiguating after function call