can't use old format_links method, need to implement a copy of it.