Now exits when an error is found while reading a file
Started to implement functions (not working yet)