Add security features.
Made the lib more generic.