Implement self-scanning option

Fixes #355