Added errors handling