Incorporated remaining part of mirage stack, ready for merge with Isidras changes.