Improved checking.
Fixed and tested checking.
Fixed file allocation.