Add level exit stuff and debug mode