restructure, big js cleanup