fixed a few issues ready for final review.