Adds mode switching
Adds preload and postload hooks