Various bug fixes/additions.