redone, more logical