Made minor changes to pull function