error catching and removing redundant code