Added repair functionality. Made the log files nice.