Final commit. Minor code improvements.