Changed pop() method and tests for it