Changed function a tad