added Timeout function