code clean up; rename function names;