reformatted part of the code; removed unneeded code