Remove handling of http errors, small refactoring