some TODO and minor code cleanup