Fixed naive BFS to tiered decomposition plus small fixes