refactor coordinates helper