added check for debugging
added some http status checks
finally working