added coord checking