Modified check to check for user permissions only once