Removed some internal functions from exposed functions for Lua. Code cleanup and optimizing for VC2010.