Coordinate conversion code, I hope everyone likes it