Optimization changes for Scan + added offset support and test cases + changed preprocessor definition