Added timer to function