Fixed a few issues highlighted by Matt