Advanced Language-based Techniques for Correct, Secure Networked Systems