Working on case with hat function