cleaned up comments, put duplicated lines into a function `get_selected_method`