working on write method