Cleaned up trigger code.