Code cleanup and documentation update.