Handeling a 500 error sometimes given by the api. Added comments