Get the correct xpath now and clean up the code tomorrow