Added checking permissions