added algo to control interval & format