Refactor #3878 #3922 #3963 #3983: Put temporary proto variable in window