Program functioning now with exceptions