Write function is almost done