pascal.c refactor