add option for serialization; additional functionality; tests