addition of mode class, a few fixes in mask and fix for SSL being
unenabled