tweaked / cleaned up XRF background calc