changed logic structures