removing usage of settimeout