Added the first untested version of serilization

- Added the serialize function
- chacged the callback method of deserialize function to take
two arguments: (err, pair).