Add javadoc, and make the flush interval configurable