Redo js to be faster and cleaner

downside is that the navigation doesnt update across the iframes as i couldnt find a reliable way of doing it