Auto detection almost done

Saved filename having some issue, needs to be fixed