fixed code to allow duplicate routines in daily, cleaned up some code