Added new method for serializing to intermediate