started calculating dynamic stack, not working