factored out constants and fixed logic