Fixed it and handled errors