Rewrote global variable related things.
fork me!