Refactor test.c