refactoring; undo commons I/O for the sake of efficiency. using ArrayBuffer instead.