added timeout and some scan stuff