Changed write implementation to support block-based writes