Added some comments and reformatted to fit optimizer changes