Added determine frequency from stack