I like the pop solution. Updated. Tests seem to be passing, so seems ready to merge whenever convenient.