added mid IR function