Add exceptions handling. Now it doesn't work and need to be fixed.