Logic updates, optimization