C98 refactor
issue #1: convert to pure C89