scoping timeout function