Made target/arch/etc detection a bit more sane, and debug logging