Improved coord change function
Update change coord function and clean main