Fixed formatting issues and added comments