Sending all the bytes to stdout, refactored some methods