Added implementation for pop