Cleaned up code to present on blog entry 2.