Trying with hat function