Refactored device scanner. Activity scanner fixes.