added tolarance to distance'
added a global variable tolarance, plus some small tweaks
change chunksize to tenth of seconds + some small changes