Added pickle support.
Added pickle tests.