refactor code
 adjust interface
 change thread interface