some minor optimizations
improved scanner asynchronous behaviour