code cleanup, todo fix