working on scanning mode