Combined path logic, quite clean