Re-implemented automatic folder selection