improve some function
design database