file picking logic