added explanation and run time
removed character variable to condense code