re-added serializing code