cleaning up code and adding destination_ip sort