Bug fixes & cleanup.