Separate functions to files. Introduce constants.h. Update Makefile.