openSelected method is implemented; trailing whitespaces are removed