little bit refactored, common class resolver