improve some functions
massive update