Moved some function definitions out of a header file