add plot function, rename and add sax code