CFY-516 bug fixes and cleanup