added contracts for generic functions