not working yet but first cut at feature complete