rearrange a bunch of stuff so back/forward buttons work properly