Added permissions to command and cleaned the code up.