cleaned up scan link code