Fixed formatting problems and made the code more consistent and easier to read.