functionalize read and write
worksish
message array
cleanup