functional version; still need to change parameters to monitor.