tweaks, mostly stolen from jimmac