Simplfied checking of invalid path
Cleanup unneccessary changes