Fixed bug in backup script and rewrote format script