Code cleanup and set correct permissions for backup scripts