changed to a more logical way