Implemented getLastChanges method and added writeToFile method