Added exception handling and chron job. Chron job is not tested