More bug fixes and clean ups.