Modularized code and added ssl