move x and y def to outside click