Updates error handling (temp, needs refactoring)