Use BytesIO for reduced CPU consumption

Relates to #143