make it work with arbitrary class