Final optimizations and comments.