Unneeded files removed. Error cases added