Code cleanup and adding TODO comments