Improved security and functions