not working without x and y loops