adjust structure and add some new functions