added docs, flowchart