Implemented basic stream writer functionality