Added triggers and logic. Almost there