add some javadocs
start working on flow control