Updated for better git folder detection.