TODO cleanup, other code cleanup.