refactore form handling for label linking