factored all out of structure.c into seperate files