Improve speed by using bytearrays