update code according to flume guys review