Modifications to security class. Needs testing.