Updated api plus work on scan function