changed up x loop, still not working correctly