refactoring nmap scanning