added methods to read a file and some exceptions