dd sine wave chase, fixed bugs in code, separated out control function for
each section