thanks you two, @takethathe @seanlong 
@gaochun what's your opinion? so this code could be shared?