Clean up patch and add comments