Corrected some example variable declarations and deletions. Fixed error handling bug.