Code cleanup and updated TODO.