Error handlin improved
New_day rewritten to perl