Bug fixes. Need to merge Nate's