added internal.cpp and internal.h (internal functions not to  be
modified)