Added state variable management, debug-testing
Added state variable management, debug-testing