added write/else statements

not functioning at all. not sure what i’ve done.