add marshaller/unmarshaller and code clean up