adding sleep interval and index printing