code improvements- incorporating comments