reorganize file. also improve function to use xdg-open when available.