Handle different directory layouts better