added 'if' statements to links