Making a few changes and adding the write method