Found out why my function in worse