Optimization by lazyfication, simplified global variables
Cleanup
Optimization by lazyfication