More bug fixing, the pathfinding works now, more or less. Still more bugfixing required.