adding line by line error handling