change butterfly_detection so that code only runs if main