Refactor console sending code.