restructure frontend scripts