refactoring links app

remove use of global
change % operator to str.format
add tests