extract headers better and do a better job testing