implemented int and promise based timeout