More queryDB code refactoring added to links module