made a function to speed up the time #2