some util classes stolen from webfunds