updated flow and comments