Extended test coverage, improved pop() to handle exceptions