Updated kdglib, and reworked patch support