prep code for level switching