Tidy up the main Lua load sequence a lot