Added security module with mask checking, tests. Not yet integrated with commands.