changed order of things and internal function names