some stuff stolen from better-defaults