Added fix for ItemAdded/Removed events sometimes being delayed; also added some basic safety checks.