added scanning, bugfixes