added echoes and headers to state array

headers make it easy to build testable functions that set http headers.
echoes makes it easy to build testable functions that echo output.
added automatic handling of headers and echos