Add a trait for coordiate type, and use throughout