little modifications in documentation
change condition in queries for properly handling end of the scenario