Refactor vertex functions, add some edge functions