some refactoring, add function to submit new link