add some function to main and core