Finished optimization, please add comments where requested