made (mostly) ANSI compliant