rewritten editVertex() using ternary operator