Refactor pop, dup, and swap functions by making use of recent refactors.