added secure mode stuff
