arrange the code here, make file structure more clean