Adjusted code for new methods and security