Improve the patch for FreeBSD 10 and also make it more readble to help integration into FreeBSD