Code cleanup and comment