refactore coordinate system