Fixed: While reading from file, assert added to check if the number of values
read from one line correspond to number of needed values.
Simple testing done. Fixed some errors, like clearing input buffer, checking if a file exists before writing into it, deallocating memory where needed.