Added exceptions handling