some goodies from joels repo