Cleaned up code, update last run date only after successful completion.