isReturn function implemented