reformatted my code to make it easier to read