halfway implemented null branch (i.e. sample) -- need to finish up with the JS