function 'coords' working correctly