Fixed bugs and added save to log feature