trying to adhere to ansi C standards