Added a class to check validity of buffer when file is loaded. Need to test and refactor.