Migrated to ANSI C standard.
Some renames and moves.