restructure of code