Added save method and load function