reformatting some of the code