Added test case and made StackElem constructor explicit