added print function for scan and map implementation