Added counting and various File Error checks