Use strict mode and wrap all code in self exec funcs. Also fixed some bugs I noticed after enabling strict mode.