Added some of the basis for LUA Scripting and cleaned code