Cleaned up funcs.cpp