Improved push and pull functions
Fixed the push and pull functions