cleaner memory in functions.h
try to add restrict to pointer declarations