slowly refactoring rule30.c; still not working