Eliminate more TODO's and fix a bug