Code cleanup and additional comments added.