refactored coordinate drawing