refactored pop method in linkedstack