Added lots of internal functions, first steps at supporting R's namespace mechanism