Patches pushed as 0e007842c9ab3021160596a0de14a2ef1b94acb2 and following with a few modifications. Thanks.