Fixed path finding and updated a few functions.