rewriting link creation, still a lot to do