replaced extraneous code with existing function
reformatting
comment edit