modified the flow chart