Removed unused code.
Handle errors.