Added serialize method for compiler