Merging chaps. #3 and #4. This closes #4