added top() and isEmpty() method