errorhandling
made some functions public
refactoring of PalaceSecurityError