Added options parameter to serialize function