Extract red and green output into functions