Added general stack.
General improvement and bug fixes to lua subsystem.