Added beginning of writing and defaults; added some type checking on ID.