added comments to describe intent of half written code