Implemented method writeToDisk