changed code for initial search for parent
changes code for initial search for parent