improved curve detection by expanding rolling mean