basic functionality of cummin and cummax implemented