a simpler, shorter and faster write() implementation

as the subjects say...a simpler, more effcient (less "if") implementation for write