Added scan for simplifying the code

More to come.