add stack, improve structure design