updated code
pickle for persistence