Implement freeze generic function