Added comments and fixes for ticket #397
Improved tracking of external modifications and added many comments
Authored by: numere 2019-07-11
Parent: [r597]
Child: [r599]