moved all fucntionality into link function for v1
cleaned up link function