Implement push, pop, unshift, and shift methods.