Refactor Thread and ExecutionStack