working on curve analysis function