Modified ValidatePath function

using an ArrayList to store correct path information