Added file saving, small bug fix