Fixed up sqlGetCords code so query to db was only made once instead of three times