Added support for generics! Was too easy, need to test complex scenarios!