Add helper functions. Fix makefile.