Clean up staged write and tests