Exceptions handling; refactoring; timeout fixed