code restructure, js back inline