added stack.distribution as parameter