[UPDATE] reorganized moving mean code.