Improved generic constraint support. Added unit tests for generic methods.