Bug fixes. Some comments updated to reflect changes.