Added "getLastElem" method and test for it.