made x and y variable local