refactored scan and scanobject