reverted to the old macro because it was buggy