Change in how scripts are loaded

Engine scripts are now loaded sequentially to remove issues when loaded
out of order. Main is also called automaticlaly when all scripts are
loaded and the window is loaded.