Added exception logic