updated hw with more error catching