more logical code