Minor revisions and code cleanup (removed unused code).