renamed and smoothed out functions per Ozh comments.