fixing link, removing duplicated code