Added if statements and associations