1st draft of decision procedure. still primitive. needs thinking.