change some inner logic, add some funcs