refactored the runtime stack